package com.sun.test.controller;

import com.sun.test.dao.UserDao;
import com.sun.test.domain.User;
import com.sun.test.dto.UserBaseRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.lang.annotation.Target;

/**
 * @author zhangquanwei
 * @version 1.0
 * @date 2024-12-17 14:02
 */
@Tag(name = "用户管理")
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserDao userDao;

    @PostMapping("/getByUserId")
    @Operation(summary = "/getByUserId",description = "根据用户ID查询用户信息")
    public User getByUserId(@RequestBody UserBaseRequest req) {
        return userDao.getByUserId(req.getUserId());
    }

    @PostMapping("/insert")
    public void insert() {
        User user = new User();
        user.setUserId("123456");
        user.setUserName("测试专员");
        user.setEmail("qqqq@sun.com");
        user.setPhone("15633338888");
        user.setRemark("测试备注");
        userDao.insert(user);
    }

    @GetMapping("/hello")
    @ResponseBody
    public String hello() {
        return "hello,world";
    }

}
